'\" te
.\" Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH LOGADM 8 "June 20, 2021"
.SH NAME
logadm \- manage endlessly growing log files
.SH SYNOPSIS
.nf
\fBlogadm\fR
.fi

.LP
.nf
\fBlogadm\fR [\fB-\fIoptions\fR\fR] \fIlogname\fR...
.fi

.SH DESCRIPTION
\fBlogadm\fR is a general log rotation tool that is suitable for running from
\fBcron\fR(8).
.sp
.LP
Without arguments, \fBlogadm\fR reads the \fB/etc/logadm.conf\fR file, and for
every entry found in that file checks the corresponding log file to see if it
should be rotated. Typically this check is done each morning by an entry in the
root's \fBcrontab\fR.
.sp
.LP
If the \fIlogname\fR argument is specified, \fBlogadm\fR renames the
corresponding log file by adding a suffix so that the most recent log file ends
with \fB\&.0\fR (that is, \fIlogfile\fR\fB\&.0\fR), the next most recent ends
with \fB\&.1\fR (that is, \fIlogfile\fR\fB\&.1\fR), and so forth. By default,
ten versions of old log files are kept (that is, \fIlogfile\fR\fB\&.0\fR
through \fIlogfile\fR\fB\&.9\fR). At the point when what would be the eleventh
file is logged, \fBlogadm\fR automatically deletes the oldest version to keep
the count of files at ten.
.sp
.LP
\fBlogadm\fR takes a number of \fIoptions\fR. You can specify these options on
the command line or in the \fB/etc/logadm.conf\fR file. The \fBlogadm\fR
command searches \fB/etc/logadm.conf\fR for lines of the form \fIlogname\fR
\fIoptions\fR
.sp
.ne 2
.na
\fB\fIlogname\fR\fR
.ad
.sp .6
.RS 4n
Identifies an entry in \fB/etc/logadm.conf\fR. This can be a name or the
pathname of the log file. If you specify a log file, rather than a name, for
this field, it must be a fully qualified pathname.
.RE

.sp
.ne 2
.na
\fB\fIoptions\fR\fR
.ad
.sp .6
.RS 4n
Identifies command line options exactly as they would be entered on the command
line. This allows commonly used log rotation policies to be stored in the
\fB/etc/logadm.conf\fR file. See \fBEXAMPLES\fR.
.sp
If \fIoptions\fR are specified both in \fB/etc/logadm.conf\fR and on the
command line, those in the \fB/etc/logadm.conf\fR file are applied first.
Therefore, the command line options override those in \fB/etc/logadm.conf\fR.
.sp
Log file names specified in \fB/etc/logadm.conf\fR may contain filename
substitution characters such as \fB*\fR and \fB?\fR, that are supported by
\fBcsh\fR(1).
.RE

.sp
.LP
Two options control when a log file is rotated. They are: \fB-s\fR size
\fB-p\fR period.
.sp
.LP
When using more than one of these options at a time, there is an implied
\fBand\fR between them. This means that all conditions must be met before the
log is rotated.
.sp
.LP
If neither of these two options are specified, the default conditions for
rotating a log file are: \fB\fR\fB-s\fR \fB1b\fR \fB-p\fR \fB1w\fR, which means
the log file is only rotated if the size is non-zero and if at least 1 week has
passed since the last time it was rotated.
.sp
.LP
By specifying \fB\fR\fB-p\fR \fBnever\fR as a rotation condition, any other
rotation conditions are ignored and \fBlogadm\fR moves on to the expiration of
old log files. By specifying \fB\fR\fB-p\fR \fBnow\fR as a rotation condition,
a log rotation is forced.
.sp
.LP
Unless specified by the \fB-o\fR, \fB-g\fR, or \fB-m\fR options, \fBlogadm\fR
replaces the log file (after renaming it) by creating an empty file whose
owner, group ID, and permissions match the original file.
.sp
.LP
Three options control when old log files are expired: \fB-A\fR age \fB-C\fR
count \fB-S\fR size. These options expire the oldest log files until a
particular condition or conditions are met. For example, the combination of the
\fB\fR\fB-C\fR \fB5\fR and \fB\fR\fB-S\fR \fB10m\fR options expires old log
files until there are no more than 5 of them \fBand\fR their combined disk usage
is no more than 10 megabytes. If none of these options are specified, the
default expiration is \fB\fR\fB-C\fR \fB10\fR which keeps ten old log files. If
no files are to be expired, use \fB\fR\fB-C\fR \fB0\fR to prevent expiration by
default.
.SH OPTIONS
The following options are supported:
.sp
.ne 2
.na
\fB\fB-a\fR \fIpost_command\fR\fR
.ad
.sp .6
.RS 4n
Execute the \fIpost_command\fR after renaming the log file. \fIpost_command\fR
is passed to \fBsh\fR \fB-c\fR.
.sp
Specify \fIpost_command\fR as a valid shell command. Use quotes to protect
spaces or shell metacharacters in \fIpost_command\fR.
.sp
This option can be used to restart a daemon that is writing to the file. When
rotating multiple logs with one \fBlogadm\fR command, \fIpost_command\fR is
executed only once after all the logs are rotated, not once per rotated log.
.RE

.sp
.ne 2
.na
\fB\fB-A\fR \fIage\fR\fR
.ad
.sp .6
.RS 4n
Delete any versions that have not been modified for the amount of time
specified by \fIage\fR.
.sp
Specify \fIage\fR as a number followed by an \fBh\fR (hours), \fBd\fR (days),
\fBw\fR(weeks), \fBm\fR (months), or \fBy\fR (years).
.RE

.sp
.ne 2
.na
\fB\fB-b\fR \fIpre_command\fR\fR
.ad
.sp .6
.RS 4n
Execute \fIpre_command\fR before renaming the log file. \fIpre_command\fR is
passed to \fBsh\fR \fB-c\fR.
.sp
Specify \fIpre_command\fR as a valid shell command. Use quotes to protect
spaces or shell metacharacters in the \fIpre_command\fR.
.sp
This option can be used to stop a daemon that is writing to the file. When
rotating multiple logs with one \fBlogadm\fR command, \fIpre_command\fR is
executed only once before all the logs are rotated, not once per rotated log.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.sp .6
.RS 4n
Rotate the log file by copying it and truncating the original logfile to zero
length, rather than renaming the file.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR \fIcount\fR\fR
.ad
.sp .6
.RS 4n
Delete the oldest versions until there are not more than \fIcount\fR files
left.
.sp
If no expire options (\fB-A\fR, \fB-C\fR, or \fB-S\fR) are specified,
\fB\fR\fB-C\fR \fB10\fR is the default. To prevent the default expire rule from
being added automatically, specify \fB\fR\fB-C\fR \fB0\fR .
.RE

.sp
.ne 2
.na
\fB\fB-e\fR \fImail_addr\fR\fR
.ad
.sp .6
.RS 4n
Send error messages by email to \fImail_addr\fR.
.sp
As \fBlogadm\fR is typically run from \fBcron\fR(8), error messages are
captured by \fBcron\fR and mailed to the owner of the \fBcrontab\fR.
.sp
This option is useful if you want the mail regarding error messages to go to
another address instead. If no errors are encountered, no mail message is
generated.
.RE

.sp
.ne 2
.na
\fB\fB-E\fR \fIcmd\fR\fR
.ad
.sp .6
.RS 4n
Execute \fIcmd\fR to expire the file, rather than deleting the old log file to
expire it.
.sp
\fIcmd\fR is passed it to \fBsh\fR \fB-c\fR. The file is considered expired
after \fIcmd\fR completes. If the old log file is not removed or renamed by the
\fIcmd\fR, \fBlogadm\fR considers it for expiration the next time that it runs
on the specified log file. If present, the keyword \fB$file\fR is expanded in
the specified \fIcmd\fR to the name of the file being expired.
.sp
This option is useful for tasks such as mailing old log files to
administrators, or copying old log files to long term storage.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR \fIconf_file\fR\fR
.ad
.sp .6
.RS 4n
Use \fIconf_file\fR instead of \fB/etc/logadm.conf\fR.
.sp
This option allows non-root users to keep their own \fBlogadm\fR configuration
files.
.RE

.sp
.ne 2
.na
\fB\fB-g\fR \fIgroup\fR\fR
.ad
.sp .6
.RS 4n
Create a new empty file with the \fBID\fR specified by \fIgroup\fR, instead of
preserving the group \fBID\fR of the log file.
.sp
Specify \fIgroup\fR by name or by numeric group \fBID\fR, as accepted by
\fBchgrp\fR(1).
.sp
This option requires the ability to change file group ownership using the
\fBchgrp\fR(1) command.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.sp .6
.RS 4n
Print a help message that describes \fBlogadm\fR's options.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.sp .6
.RS 4n
Use local time rather than the Coordinated Universal Time (UTC) when naming
rotated log files (see the discussion of percent sequences in the templates
supplied with the \fB-t\fR option).
.RE

.sp
.ne 2
.na
\fB\fB-m\fR \fImode\fR\fR
.ad
.sp .6
.RS 4n
Create a new empty file with the mode specified by \fImode\fR, instead of
preserving the mode of the log file.
.sp
Specify \fImode\fR in any form that is accepted by the \fBchmod\fR(1) command.
.RE

.sp
.ne 2
.na
\fB\fB-M\fR \fIcmd\fR\fR
.ad
.sp .6
.RS 4n
Use \fIcmd\fR to rename the log file. If the keyword \fB$file\fR is specified,
it is expanded to the name of the log file. Similarly, the keyword \fB$nfile\fR
is expanded to the new name of the log file. The \fB$nfile\fR keyword is only
available with commands provided with the \fB-M\fR option. After the command
completes, the log file is replaced by the rotate file. The default \fIcmd\fR
is "\fB/bin/mv\fR \fB$file\fR\fB\fR\fB$nfile\fR".
.RE

.sp
.ne 2
.na
\fB\fB-n\fR \fI\fR\fR
.ad
.sp .6
.RS 4n
Print the actions that the \fBlogadm\fR command will perform without actually
performing them.
.sp
This option is useful for checking arguments before making any changes to the
system.
.sp
It is important to remember, however, that since log rotating actions are only
printed with this option, \fBlogadm\fR might not find files that need expiring,
but if run without the \fB-n\fR \fBlogadm\fR might create a file that needs
expiring by performing the log rotating actions. Therefore, if you see no files
being expired with the \fB-n\fR option, files still might be expired without
it.
.RE

.sp
.ne 2
.na
\fB\fB-N\fR\fR
.ad
.sp .6
.RS 4n
Prevent an error message if the specified logfile does not exist. Normally,
\fBlogadm\fR produces an error message if the log file is not found. With
\fB-N\fR, if the log file doesn't exist \fBlogadm\fR moves on to the expire
rules (if any) and then to the next log file (if any), without creating the
empty replacement log file.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR \fIowner\fR\fR
.ad
.sp .6
.RS 4n
Create the new empty file with \fIowner\fR, instead of preserving the owner of
the log file.
.sp
Specify \fIowner\fR in any form that is accepted by the \fBchown\fR(1) command.
.RE

.sp
.ne 2
.na
\fB\fB-p\fR \fIperiod\fR\fR
.ad
.sp .6
.RS 4n
Rotate a log file after the specified time period (\fIperiod\fR).
.sp
Specify \fIperiod\fR as a number followed by \fBd\fR for days, \fBh\fR for
hours, \fBw\fR for weeks, \fBm\fR for months (30 days) or \fBy\fR for years.
There are also two special values for period: \fBnow\fR and \fBnever\fR.
"\fB\fR\fB-p\fR \fBnow\fR" forces log rotation. "\fB\fR\fB-p\fR \fBnever\fR"
forces no log rotation.
.RE

.sp
.ne 2
.na
\fB\fB-P\fR \fItimestamp\fR\fR
.ad
.sp .6
.RS 4n
Used by \fBlogadm\fR to record the last time the log was rotated in
\fB/etc/logadm.conf\fR.
.sp
This option uses \fItimestamp\fR to determine if the log rotation period has
passed. The format of \fItimestamp\fR matches the format generated by
\fBctime\fR(3C), with quotes around it to protect embedded spaces.
\fItimestamp\fR is always recorded in the Coordinated Universal Time (UTC)
timezone.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.sp .6
.RS 4n
Remove any entries corresponding to the specified \fIlogname\fR from the
\fB/etc/logadm.conf\fR.
.RE

.sp
.ne 2
.na
\fB\fB-R\fR \fIcmd\fR\fR
.ad
.sp .6
.RS 4n
Run the \fIcmd\fR when an old log file is created by a log rotation. If the
keyword \fB$file\fR is embedded in the specified command, it is expanded to the
name of the old log file just created by log rotation.
.sp
This option is useful for processing log file contents after rotating the log.
\fIcmd\fR is executed by passing it to \fBsh\fR \fB-c\fR. When rotating
multiple logs with one logadm command, the command supplied with \fB-R\fR is
executed once every time a log is rotated. This is useful for post-processing a
log file (that is, sorting it, removing uninteresting lines, etc.). The
\fB-a\fR option is a better choice for restarting daemons after log rotation.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fIsize\fR\fR
.ad
.sp .6
.RS 4n
Rotate the log file only if its size is greater than or equal to \fIsize\fR.
.sp
Specify \fIsize\fR as a number followed by the letter \fBb\fR for bytes,
\fBk\fR for kilobytes, \fBm\fR for megabytes, or \fBg\fR for gigabytes.
.RE

.sp
.ne 2
.na
\fB\fB-S\fR \fIsize\fR\fR
.ad
.sp .6
.RS 4n
Delete the oldest versions until the total disk space used by the old log files
is less than the specified size.
.sp
Specify \fIsize\fR as a number followed by the letter \fBb\fR for bytes,
\fBk\fR for kilobytes, \fBm\fR for megabytes, or \fBg\fR for gigabytes.
.RE

.sp
.ne 2
.na
\fB\fB-t\fR \fItemplate\fR\fR
.ad
.sp .6
.RS 4n
Specify the template to use when renaming log files.
.sp
\fItemplate\fR can be a simple name, such as \fB/var/adm/oldfile\fR, or it can
contain special keywords which are expanded by \fBlogadm\fR and are in the form
\fB$\fR\fIword\fR. Allowed sequences are:
.sp
.ne 2
.na
\fB$\fIbasename\fR\fR
.ad
.sp .6
.RS 4n
The log file name, without the directory name
.RE

.sp
.ne 2
.na
\fB$\fIdirname\fR\fR
.ad
.sp .6
.RS 4n
The directory of the file to be rotated
.RE

.sp
.ne 2
.na
\fB$\fIdomain\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBdomainname\fR
.RE

.sp
.ne 2
.na
\fB$\fIfile\fR\fR
.ad
.sp .6
.RS 4n
The full path name of the file to be rotated
.RE

.sp
.ne 2
.na
\fB$\fIisa\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBuname\fR \fB-p\fR
.RE

.sp
.ne 2
.na
\fB$\fImachine\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBuname\fR \fB-m\fR
.RE

.sp
.ne 2
.na
\fB$\fIn\fR\fR
.ad
.sp .6
.RS 4n
The version number, \fB0\fR is most recent, \fB1\fR is next most recent, and so
forth
.RE

.sp
.ne 2
.na
\fB$\fIN\fR\fR
.ad
.sp .6
.RS 4n
The same as $\fIn\fR, but starts at \fB1\fR instead of zero
.RE

.sp
.ne 2
.na
\fB$\fInodename\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBuname\fR \fB-n\fR
.RE

.sp
.ne 2
.na
\fB$\fIplatform\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBuname\fR \fB-i\fR
.RE

.sp
.ne 2
.na
\fB$\fIrelease\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBuname\fR \fB-r\fR
.RE

.sp
.ne 2
.na
\fB$\fIsecs\fR\fR
.ad
.sp .6
.RS 4n
The number of seconds since \fB00:00:00 UTC, January 1,1970\fR
.RE

.sp
.ne 2
.na
\fB$\fIzonename\fR\fR
.ad
.sp .6
.RS 4n
Expands to the output of \fBzonename\fR(1).
.RE

To actually have the dollar sign character in the file name, use \fB$$\fR. Any
percent sequences allowed by \fBstrftime\fR(3C) are also allowed, for example,
\fB%d\fR expands to the day of the month. To actually have a percent sign
character in the file name, use \fB%%\fR. Both dollar-sign keywords and percent
sequences can appear anywhere in the template. If the template results in a
pathname with non-existent directories, they are created as necessary when
rotating the log file.
.sp
If no \fB-t\fR option is specified, the default template is \fB$file.$n\fR.
Actual \fBrotation\fR of log files, where each version is shifted up until it
expires is done using the \fB$n\fR keyword. If the template does not contain
the \fB$n\fR keyword, the log file is simply renamed to the new name and then
the expire rules, if any, are applied.
.RE

.sp
.ne 2
.na
\fB\fB-T\fR \fIpattern\fR\fR
.ad
.sp .6
.RS 4n
Normally \fBlogadm\fR looks for a list of old log files by turning the template
(specified with the \fB-t\fR option) into a pattern and finding existing files
whose names match that pattern. The \fB-T\fR option causes the given pattern to
be used instead.
.sp
This option is useful if another program fiddles with the old log file names,
like a \fBcron\fR job to compress them over time. The pattern is in the form of
a pathname with special characters such as \fB*\fR and \fB?\fR as supported by
\fBcsh\fR(1) filename substitution.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.sp .6
.RS 4n
Print information about the actions being executed in verbose mode.
.RE

.sp
.ne 2
.na
\fB\fB-V\fR\fR
.ad
.sp .6
.RS 4n
Validate the configuration file.
.sp
This option validates that an entry for the specified \fIlogname\fR exists in
the \fB/etc/logadm.conf\fR file and is syntactically correct. If \fIlogname\fR
is not specified, all entries in the configuration file are validated. If a
\fBlogname\fR argument is specified, the command validates the syntax of that
entry. If the entry is found, it is printed and the exit value of the command
is true. Otherwise the exit value is false.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR \fIentryname\fR\fR
.ad
.sp .6
.RS 4n
Write an entry into the config file (that is, \fB/etc/logadm.conf\fR) that
corresponds to the current command line arguments. If an entry already existed
for the specified \fIentryname\fR, it is removed first. This is the preferred
method for updating \fB/etc/logadm.conf\fR, because it prevents syntax errors.
The \fIentryname\fR is an argument to an invocation of \fBlogadm\fR.
\fIentryname\fR might be chosen as something easy to remember or it can be the
pathname of the log file. If a pathname, rather than a name is used, it must be
a fully qualified pathname.
.sp
If no log file name is provided on a \fBlogadm\fR command line, the entry name
is assumed to be the same as the log file name. For example, the following two
lines achieve the same thing, keeping two copies of rotated log files:
.sp
.in +2
.nf
% logadm -C2 -w mylog /my/really/long/log/file/name
% logadm -C2 -w /my/really/long/log/file/name
.fi
.in -2
.sp

.RE

.sp
.ne 2
.na
\fB\fB-z\fR \fIcount\fR\fR
.ad
.sp .6
.RS 4n
Compress old log files after all other commands have been executed. \fIcount\fR
of the most recent log files are left uncompressed, therefore making the
\fIcount\fR most recent files easier to peruse. Use \fIcount\fR of zero to
compress all old logs.
.sp
The compression is done with \fBgzip\fR(1) and the resulting log file has the
suffix of \fB\&.gz\fR.
.RE

.SH OPERANDS
The following operands are supported:
.sp
.ne 2
.na
\fB\fIlogname\fR\fR
.ad
.sp .6
.RS 4n
Identifies the name of the entry in \fB/etc/logadm.conf\fR. If the log file
name is specified in the \fIlogname\fR field, it is assumed that \fIlogname\fR
is the same as the actual log file name.
.RE

.SH EXAMPLES
\fBExample 1 \fRRotating a File and Keeping Previous Versions
.sp
.LP
The following example rotates the \fB/var/adm/exacct/proc\fR file, keeping ten
previous versions in \fB/var/adm/exacct/proc.0\fR through
\fB/var/adm/exacct/proc.9\fR.

.sp
.LP
Tell \fBlogadm\fR to copy the file and truncate it.

.sp
.in +2
.nf
 % logadm -c /var/adm/exacct/proc
.fi
.in -2
.sp

.LP
\fBExample 2 \fRRotating syslog
.sp
.LP
The following example rotates \fBsyslog\fR and keeps eight log files. Old log
files are put in the directory \fB/var/oldlogs\fR instead of \fB/var/log\fR:

.sp
.in +2
.nf
% logadm -C8 -t'/var/oldlogs/syslog.$n' /var/log/syslog
.fi
.in -2
.sp

.LP
\fBExample 3 \fRRotating /var/adm/sulog and Expiring Based on Age
.sp
.LP
The following entry in the \fB/etc/logadm.conf\fR file rotates the
\fB/var/adm/sulog\fR file and expires any copies older than 30 days.

.sp
.in +2
.nf
/var/adm/sulog -A 30d
.fi
.in -2
.sp

.LP
\fBExample 4 \fRRotating Files and Expiring Based on Disk Usage
.sp
.LP
The following entry in the \fB/etc/logadm.conf\fR file rotates the
\fB/var/adm/sulog\fR file and expires old log files when more than 100
megabytes are used by the sum of all the rotated log files.

.sp
.in +2
.nf
/var/adm/sulog -S 100m
.fi
.in -2
.sp

.LP
\fBExample 5 \fRCreating an Entry that Stores the Logfile Name
.sp
.LP
This example creates an entry storing the log file name and the fact that we
want to keep 20 copies in \fB/etc/logadm.conf\fR, but the \fB\fR\fB-p\fR
\fBnever\fR means the entry is ignored by the normal \fBlogadm\fR run from
root's crontab every morning.

.sp
.in +2
.nf
% logadm -w locallog /usr/local/logfile -C20 -p never
.fi
.in -2
.sp

.sp
.LP
Use the following entry on the command line to override the \fB\fR\fB-p\fR
\fBnever\fR option:

.sp
.in +2
.nf
 % logadm -p now locallog
.fi
.in -2
.sp

.LP
\fBExample 6 \fRRotating the apache Error and Access Logs
.sp
.LP
The following example rotates the apache error and access logs monthly to
filenames based on current year and month. It keeps the 24 most recent copies
and tells apache to restart after renaming the logs.

.sp
.LP
This command is run once, and since the \fB-w\fR option is specified, an entry
is made in \fB/etc/logadm.conf\fR so the apache logs are rotated from now on.

.sp
.in +2
.nf
 % logadm -w apache -p 1m -C 24\e
     -t '/var/apache/old-logs/$basename.%Y-%m'\e
     -a '/usr/apache/bin/apachectl graceful'\e
     '/var/apache/logs/*{access,error}_log'
.fi
.in -2
.sp

.sp
.LP
This example also illustrates that the entry name supplied with the \fB-w\fR
option doesn't have to match the log file name. In this example, the entry name
is \fBapache\fR and once the line has been run, the entry in
\fB/etc/logadm.conf\fR can be forced to run by executing the following command:

.sp
.in +2
.nf
% logadm -p now apache
.fi
.in -2
.sp

.sp
.LP
Because the expression matching the apache log file names was enclosed in
quotes, the expression is stored in \fB/etc/logadm.conf\fR, rather than the
list of files that it expands to. This means that each time \fBlogadm\fR runs
from \fBcron\fR it expands that expression and checks all the log files in the
resulting list to see if they need rotating.

.sp
.LP
The following command is an example without the quotes around the log name
expression. The shell expands the last argument into a list of log files that
exist at the time the command is entered, and writes an entry to
\fB/etc/logadm.conf\fR that rotates the files.

.sp
.in +2
.nf
logadm -w apache /var/apache/logs/*_log
.fi
.in -2
.sp

.SH FILES
.ne 2
.na
\fB\fB/etc/logadm.conf\fR\fR
.ad
.sp .6
.RS 4n
configuration file for \fBlogadm\fR command
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
.TE

.SH SEE ALSO
.BR chgrp (1),
.BR chmod (1),
.BR chown (1),
.BR csh (1),
.BR gzip (1),
.BR ctime (3C),
.BR strftime (3C),
.BR logadm.conf (5),
.BR attributes (7),
.BR cron (8)
.SH NOTES
When \fBlogadm\fR applies expire conditions (supplied by the \fB-A\fR,
\fB-C\fR, and \fB-S\fR options), it deletes files, the oldest first, until the
conditions are satisfied. If the template used for naming the old logs
contained \fB$n\fR or \fB$N\fR, \fBlogadm\fR picks the highest value of
\fB$n\fR or \fB$N\fR found in the old log file names first. If the template
used is something else, \fBlogadm\fR uses the modification time to determine
which files to expire first. This may not be the expected behavior if an old
log file has been modified since it was rotated.
.sp
.LP
Depending on log file sizes and number of log files, log file rotations can be
very time-consuming.
.sp
.LP
By default, \fBlogadm\fR works in \fBGMT\fR. Therefore, all entries written to
the \fB/etc/logadm.conf\fR file (see \fBlogadm.conf\fR(5)) will have a
\fBGMT\fR timestamp. Users can use the \fB-l\fR option to set \fBlogadm\fR to
local time.
